import type { USER } from "@/types/user"
import type { Ref } from "vue"
import type { Router } from "vue-router"

export function useLogout(router: Router, user: Ref<USER>) {
  const logOut = () => {
    // 清楚token
    localStorage.removeItem("vue3-token")
    user.value = {} as USER
    // 跳转页面
    router.push("/login")
  }
  return {
    logOut,
  }
}
